<?php
namespace Zxf5115\Laravel\Dictionary\Logics\Dictionary;

use Illuminate\Http\Request;

/**
 * @author zhangxiaofei [<1326336909@qq.com>]
 * @dateTime 2025-09-23
 *
 * 字典参数逻辑处理类
 */
class ParameterLogic
{
  /**
   * 系统资料数据处理
   *
   * @param Request $request 用户请求参数
   * @param string $modelClass 操作模型类
   * @return void
   */
  public function handle(Request $request, string $modelClass) : void
  {
    $model = $modelClass::firstOrNew(['id' => $request->id]);

    $model->dictionary_id = $request->dictionary_id;
    $model->title = $request->title;
    $model->value = $request->value;
    $model->sort = $request->sort ?? 0;
    $model->status = intval($request->status);
    $model->save();
  }
}
